 
<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.researcher.domain.*,cn.ac.cintcm.dataconverge.util.*" pageEncoding="UTF-8"%>
<%@ page import="cn.ac.cintcm.dataconverge.researchsubject.domain.*,java.util.*,com.hs.core.page.PageUtil,com.hs.core.utils.*" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
boolean isAdmin = AuthCheck.isInGroup(request,Constants.SYSTEM_MANAGER);
PageUtil pageUtil = (PageUtil)request.getAttribute("messageList");
String pageStr = ""; 
int perpageCount = 1;
int currentPage = 1;
List list = null;
if(null != pageUtil){
   list = pageUtil.getPageList();
   pageStr = pageUtil.getPageStr();
   perpageCount = pageUtil.getNumberPerPage();
   currentPage = pageUtil.getCurrentPage();
} 
String orderName = (String)request.getAttribute("orderName");
String orderNum = (String)request.getAttribute("orderNum");  


%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title>通知公告管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    
     <link href="<%=basePath%>index/Themes/com/style.css" rel="stylesheet" type="text/css" />
    <script src="<%=basePath%>index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
      <script src="<%=basePath%>js/common.js" language="javascript" type="text/javascript"></script>
       <script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/subject.js'></script>
    <script language="javascript">
    	function del(id){
    		if(window.confirm("确定删除此通知公告？","确定","取消")){		    		
	  			 subject.updateMessage(id,callBackDelete);
	  		}
    	}
    	function callBackDelete(message){
    	   alert("删除成功");
    	   pageForm.submit();
    	}
    	function rel(id){
    		 openwindow('<%=path%>/subjectSearch.htm?action=editMessage&messageId='+id,'600','350');
    	}
    	var messageId = "";
    	var public1 = "";
    	function isPublish(message,public){ 
   
    	     if('0' == public){
    	        public = '1';
    	     }else{
    	        public = '0';
    	     }
    	        
    	 	 subject.publishMessage(message,public,publishCallBack);
    	 	 messageId = message;
    	}
    	function publishCallBack(message){
    	     var message = '';
    	     if(public1 == '0'){
    	         message = "发布";
    	     }
    	     if(public1 == '1'){
    	            message = "取消发布";
    	         }
    	         document.getElementById("publish_"+messageId).innerHTML=message;
    	     document.pageForm.submit();
    	}
    </script>
  </head>
 
<body  scroll="yes">
      <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <img src="<%=basePath%>index/Themes/com/idt_tb_pass.gif" />&nbsp;通知公告管理
        </div>
    </div>
     <table cellspacing="2" cellpadding="0" width="100%" class="idt_item_mg" id="Table2">
     <tbody><form name="searchform" action="subjectSearch.htm?action=listMessage" method="post">
        <tr>
		<td class="fim_l"> 标题:</td>
            <td class="fim_r">
                <input type="text" class="com_textbox" id="informTitle" name="informTitle" value="<%=StringUtilTool.setObjNULLStr(request.getAttribute("informTitle")) %>"></td>
                <td class="fim_l"> 发布人:</td>
            <td class="fim_r"> 
                <input type="text" class="com_textbox" id="regUser"  name="regUser"   value="<%=StringUtilTool.setObjNULLStr(request.getAttribute("regUser")) %>">
                </td>
            <td class="fim_r" align="right" colspan="2">
                <input type="submit" value="查询" name="B3" class="com_btn2" id="Button5">
                <input type="button" value="添加" name="B4" class="com_btn2" id="Button2" onclick="javascript:openwindow('<%=path%>/subjectSearch.htm?action=editMessage','600','350');">
			
            </td>
        </tr></form></tbody>
    </table>
    <div class="content">
        <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4" >
            <tr>
                <td class="dg_headerstyle">
                    序号</td>
               <td class="dg_headerstyle" >
                    <a href="javaScript:orderPage('informTitle','<%=OrderTool.getOrderNum("informTitle",orderName,orderNum)%>');">标题&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("informTitle",orderName,orderNum))%></a></td>
                  <td class="dg_headerstyle" >
                    <a href="javaScript:orderPage('regUser.name','<%=OrderTool.getOrderNum("regUser.name",orderName,orderNum)%>');">发布人&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("regUser.name",orderName,orderNum))%></a></td>
                  <td class="dg_headerstyle" >
                    <a href="javaScript:orderPage('regDate','<%=OrderTool.getOrderNum("regDate",orderName,orderNum)%>');">发布时间&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("regDate",orderName,orderNum))%></td>
                    <td class="dg_headerstyle" >
                    <a href="javaScript:orderPage('extend1','<%=OrderTool.getOrderNum("extend1",orderName,orderNum)%>');">是否发布&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("extend1",orderName,orderNum))%></td>
                    <td class="dg_headerstyle">操作</td> 
                  
            </tr>
            <% 
            if(list != null && list.size()>0){ 
            	for(int i = 0;i<list.size();i++){
            	ResmanInform inform= (ResmanInform)list.get(i);
            %>
            <tr class="dg_alternatingitemstyle" onmouseover="ChangeRowBg(this);" onmouseout="ChangeRowBg(this);" onmouseup="ChangeRowBg(this);" onmousedown="ChangeRowBg(this);">
                <td align="center" width="5%">
                   <%= perpageCount*(currentPage-1)+i+1 %></td>
                <td width="40%">
                    <%=inform.getInformTitle() %>
                </td>
                <td width="10%" align="center">
                    <%if(inform.getRegUser()!=null){
                       out.println(inform.getRegUser().getName());
                    } %>
                </td>
                <td width="8%" align="center">
                    <%=inform.getRegDate() %>
                </td>
                 <td width="8%" align="center">
                    <a href="#" onclick="isPublish('<%=inform.getId()%>','<%=inform.getExtend1() %>');">
                    <span id="publish_<%=inform.getId()%>">
                    <%if("1".equals(inform.getExtend1())){ %>
                       取消发布
                    <%}else{ %> 
                       发布
                    <%} %>
                    </span></a>
                </td>
                
                 <td align="center" width="10%"> 
                <img style="cursor: hand" src="<%=basePath%>index/Themes/com/table_(edit)_16x16.gif" onclick="javascript:rel('<%=inform.getId() %>');"
               alt="编辑" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <img style="cursor: hand" src="<%=basePath%>index/Themes/com/table_(delete)_16x16.gif" onclick="javascript:del('<%=inform.getId() %>');"
               alt="删除" />
                </td>  
            </tr> 
            <%}}else{ %>
            <tr class="dg_alternatingitemstyle" align="center">
                <td colspan="7"><font color="red">没有找到记录</font></td>
                
            </tr>
            <%} %>
        </table>
        <div class="dg_pagerstyle" align="right">
        <%=pageStr%>
        </div>
    </div>
  </body>
</html>
